
cc.Class({
    extends: cc.Component,

    properties: {

    },
    initPannel() {
        let data = cc.sys.localStorage.getItem("saved");
        if (data) {
            data = JSON.parse(data);
        } else {
            data = {
                round: -1,
                kill: -1,
                live: -1
            }
        }
        let newData = game.getResultInfo();
        this.lbTurn.string = "挑战波次：" + newData.round;
        this.lbKill.string = "消灭怪物：" + newData.kill;
        let m = Math.floor(newData.live / 60);
        let s = Math.floor(newData.live % 60);
        this.lbLive.string = "存活时间：" + m + "m" + s + "s";
    },
    reChallenge() {
        game.onClear();
        cc.director.loadScene("game");
    },
    start() {
        this.lbTurn = cc.find("resultLayer/turn", this.node).getComponent(cc.Label);
        this.lbKill = cc.find("resultLayer/kill", this.node).getComponent(cc.Label);
        this.lbLive = cc.find("resultLayer/live", this.node).getComponent(cc.Label);
        // this.lbTurn = this.turn.getComponent(cc.Label);
        // this.lbKill = this.kill.getComponent(cc.Label);
        // this.lbLive = this.getComponent(cc.Label);
        this.lbTurn.new = this.lbTurn.node.getChildByName("new");
        this.lbKill.new = this.lbKill.node.getChildByName("new");
        this.lbLive.new = this.lbLive.node.getChildByName("new");
        this.initPannel();
    },

    // update (dt) {},
});
